package com.wnhz.work.yz.fragment.video;


import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.wnhz.work.yz.R;
import com.wnhz.work.yz.base.BaseFragment;
import com.wnhz.work.yz.base.BaseRVAdapter;
import com.wnhz.work.yz.base.BaseViewHolder;
import com.wnhz.work.yz.bean.VideoBean;

import java.util.ArrayList;
import java.util.List;

/**
 * A simple {@link Fragment} subclass.
 * ---产品推介
 */
public class IntroduceFragment extends BaseFragment {
    private View view;
    private RecyclerView my_recycler;
    private BaseRVAdapter<VideoBean> videoAdapter;
    private List<VideoBean> beanList = new ArrayList<>();

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        view = inflater.inflate(R.layout.fragment_introduce, container, false);
        initData();
        initView();
        return view;
    }

    private void initData() {
        for (int i = 0; i < 2; i++) {
            VideoBean bean = new VideoBean();
            beanList.add(bean);
        }
    }

    private void initView() {
        my_recycler = (RecyclerView) view.findViewById(R.id.my_recycler);

        videoAdapter = new BaseRVAdapter<VideoBean>(getActivity(), beanList) {
            @Override
            public int getLayoutId(int viewType) {
                return R.layout.frag_video_item;
            }

            @Override
            public void onBind(BaseViewHolder holder, int position) {

            }
        };
        my_recycler.setLayoutManager(new GridLayoutManager(getActivity(), 2));
        my_recycler.setAdapter(videoAdapter);
    }

}
